Skip to content

Conversation

@lutgaru
Copy link
Collaborator

@lutgaru lutgaru commented Aug 30, 2025

Summary

This PR introduces the first implementation of graph mode for SerialGUI-rs, allowing users to visualize serial data as a chart.

Key Changes

  • ChartPanel Added

    • New ChartPanel struct for rendering real-time data as a graph.
    • Efficient sample buffering and parsing of comma-separated float values from the serial stream.
    • Auto-scaling axes and grid lines for improved visualization.
    • Modularized chart functionality in src/gui/chart_panel.rs.
  • Settings Integration

    • Added show_chart_panel and show_text_panel options to AppSettings.
    • Users can toggle chart and text panels independently from both the settings panel and menu bar.
    • Ensured at least one panel is always enabled for usability.
  • UI Updates

    • Chart and text panels can be displayed side-by-side or individually.
    • Menu bar and settings panel updated to include new toggles for graph mode.
    • Improved layout logic for dynamic panel sizing.
  • Module Organization

    • Updated module exports and imports for easier integration.
    • Re-exported ChartPanel in gui/mod.rs.

Motivation

This feature provides users with a visual representation of incoming serial data, enhancing the application's usability for monitoring and analysis.


Note:
This is an initial implementation; further improvements and features may be added in future

- Add new ChartPanel component
- Implement dual-panel layout supporting both text and chart views
- Add panel visibility controls with mutual exclusion logic
- Extend AppSettings with show_chart_panel and show_text_panel flags
- Update menu bar with panel toggle checkboxes that prevent disabling both panels
- Add chart panel settings to settings panel
- Implement dynamic space allocation when both panels are visible
- Export ChartPanel in gui module for app-wide access
- Add CSV data parsing with stream buffering to handle fragmented serial data
- Implement auto-scaling chart display based on actual data ranges
- Add samples storage using VecDeque<f32> with 1000-sample limit
- Integrate chart data processing into main app serial event handling
- Replace animated sine waves with real-time data visualization
- Add horizontal grid lines for better data readability
- Implement robust parsing that handles incomplete CSV streams
- Add buffer management to prevent memory growth from partial data

The chart panel now parses comma-separated numeric values from serial data
and displays them as a line chart with automatic Y-axis scaling and padding.
Data processing only occurs when chart panel is visible for performance.
Stream buffer handles fragmented data across multiple serial packets.
@lutgaru lutgaru merged commit 50864a2 into master Sep 2, 2025
21 checks passed
@lutgaru lutgaru deleted the graph_mode branch September 2, 2025 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant